package com.yuw.control.userinfo;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.yuw.model.UserInfoModel;
import com.yuw.utils.EasyFactory;

@WebServlet("/UserInfoDeletingControl")
public class UserInfoDeletingControl extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 从request中获取id主键值
		String strUserId = request.getParameter("uid");
		// 字符串转换为int类型
		Integer userId = Integer.valueOf(strUserId);
		// 调用model层进行删除业务逻辑操作
		int i = EasyFactory.getNewInstance(UserInfoModel.class).deleteUserInfoById(userId);
		// 显示数据,使用转发或者是重定向跳转到另外一个Control进行后台处理
		//request.getRequestDispatcher("UserInfoQueryingControl").forward(request, response);
		// 使用转发跳转到另外一个Control进行后台处理
		response.sendRedirect("UserInfoQueryingControl?falg=1");
	}   
}
